package com.ease.model.criterion;

import java.util.List;

import com.ease.common.vo.Entry;

/**
 * 
 * @author nathanleewei
 * 
 */
public class NotNullExpression extends CriterionSupport implements Criterion {
	/**
	 *
	 */
	private static final long serialVersionUID = -1621204374094364140L;

	private String propertyName;

	public NotNullExpression() {

	}

	public String getPropertyName() {
		return propertyName;
	}

	public void setPropertyName(String propertyName) {
		this.propertyName = propertyName;
	}

	protected NotNullExpression(String propertyName) {
		this.propertyName = propertyName;
	}

	public String toString() {
		return propertyName + " is not null";
	}

	public String toSqlString(QueryCriteria queryCriteria) {

		String columnName = queryCriteria.getColumnNameByPropertyName(propertyName, null);
		StringBuffer fragment = new StringBuffer();
		fragment.append(columnName).append(" is not null");
		return fragment.toString();
	}

	public List<Entry<String, Object>> getNamedValue(QueryCriteria queryCriteria) {

		return this.safeNamedValue(null);
	}

}
